<template>
    <div>
      <van-nav-bar 
        :title="pageTitle"
        class="nav-bar-custom"
        left-arrow
        @click-left="goBack"
      >
      </van-nav-bar>
      <!-- <div class="search-header">
        <div class="header">
          <img src="/images/back.png" @click="goback">
          <span>个人中心</span>
          <span>隐藏</span>
        </div>
      </div> -->

      <div class="profile-container">
        <div class="profile-header">
            <img class="profile-avatar" src="/avatars/avatar.jpg" alt="Profile avatar">
            <h1 class="profile-username">{{ username }}</h1>
        </div>
        <div class="profile-content">
            <button @click="myEvents">我的活动</button>
        </div>
        <div class="profile-logout">
            <button @click="logOut">退出登录</button>
        </div>
    </div>
  
    </div>

  </template>
  
  <script>
  export default {
    name: 'UserProfile',
    data() {
      return {
        pageTitle: '个人中心',
        username: '用户名'
      };
    },
    methods: {
        goBack() {
            this.$router.back(-1)
        },
        myEvents(){
            console.log("My Events.")
            this.$router.push('/user/act')
        },
        logOut(){
            console.log("Log out!")
            this.$router.push('/auth/login/test')
        }
    },
  };
  </script>
  
  <style scoped>
  .nav-bar-custom {
  color: white;
}
  /* .profile-container {
    padding: 1em;
    font-family: 'Arial', sans-serif;
  } */
  .profile-content button {
  background: linear-gradient(45deg, #6DD5FA, #FF758C); /* 一个漂亮的蓝到粉红色渐变 */
  color: white; /* 白色文本 */
  border: none; /* 无边框 */
  padding: 10px 15px; /* 内部填充 */
  font-size: 1em; /* 字体大小 */
  font-weight: bold; /* 字体加粗 */
  border-radius: 30px; /* 圆角边框 */
  cursor: pointer; /* 鼠标悬停时显示手型 */
  transition: all 0.3s ease; /* 平滑过渡效果 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 轻微的阴影 */
}


.profile-logout button {
  background: linear-gradient(45deg, #6DD5FA, #75ce16); /* 一个漂亮的蓝到粉红色渐变 */
  color: white; /* 白色文本 */
  border: none; /* 无边框 */
  padding: 10px 15px; /* 内部填充 */
  font-size: 1em; /* 字体大小 */
  font-weight: bold; /* 字体加粗 */
  border-radius: 30px; /* 圆角边框 */
  cursor: pointer; /* 鼠标悬停时显示手型 */
  transition: all 0.3s ease; /* 平滑过渡效果 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 轻微的阴影 */
}

.profile-content button:hover {
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2); /* 悬停时加深阴影 */
  transform: translateY(-2px); /* 悬停时轻微上移 */
}

  
  .profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1em;
  }
  
  .profile-avatar {
    width: 80px; /* 根据需要调整 */
    height: 80px; /* 根据需要调整 */
    border-radius: 50%;
    margin-top: 50px;
    margin-bottom: 0.5em;
  }
  
  .profile-username {
    font-size: 1.2em;
    color: #333;
  }
  
  .profile-content {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1em;
  }

  .profile-logout {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1em;
  }
  
  .profile-info {
    margin-bottom: 1em;
  }
  
  .profile-info h2 {
    font-size: 1em;
    color: #333;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #ccc;
  }

  /* .button-group {
    display: flex;
    justify-content: space-around;
    padding-top: 1.33rem; 
  }
  .button-group button {
    background-color: #ffe786; 
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 0 5px;
    border-radius: 5px;
  } */
  .search-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }
  .header {
    width: 100%;
    height: 1.33rem;
    background-color: #d43d3d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
  }
  .header span:last-child {
    opacity: 0;
  }
  .header img {
    width: 25px;
    height: 25px;
    padding-left: .13rem;
  }
  .search {
    width: 100%;
    height: 1.07rem;
    background-color: #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .search input {
    width: 96%;
    height: 26px;
    border-radius: 4px;
    border: #ccc;
    outline: #ccc;
    text-align: center;
  }
  .loading {
    position: absolute;
    top: 2.4rem;
    right: 0;
    bottom: 0;
    left: 0;
    text-align: center;
    background-color: #fff;
    z-index: 99;
  }
  .news-content {
    margin-top: 2.6rem;
  }
  .section {
    width: 100%;
    height: 2.5rem;
    border-bottom: 1px solid #ccc;
  }
  .news {
    height: 2.25rem;
    box-sizing: border-box;
    margin: 10px 10px;
    display: flex;
  }
  .news-left {
    height: 100%;
    width: 2.8rem;
    display: inline-block;
  }
  .news-left img {
    width: 100%;
    height: 100%;
  }
  .news-right {
    flex: 1;
    padding-left: 10px;
  }
  .newsTitle {
    width: 100%;
    height: 62%;
    color: #404040;
    font-size: 18px;
    overflow: hidden;
  }
  .newsMessage {
    width: 100%;
    height: 38%;
    display: flex;
    align-items: flex-end;
    color: #888;
    justify-content: space-between;
    overflow: hidden;
    white-space: nowrap;
  }
  .loading {
    position: fixed;
    top: 2.4rem;
    right: 0;
    bottom: 0;
    left: 0;
    text-align: center;
    background-color: #fff;
    z-index: 99;
  }
  .loading img {
    margin-top: 30px;
    width: 50px;
    height: 50px;
    animation: loading .6s linear infinite
  }
  @keyframes loading {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }
  </style>
  